package com.xnyzc.lhy.order.service.impl.user.tab;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xnyzc.lhy.order.entity.user.tab.OaTabUser;
import com.xnyzc.lhy.order.mapper.user.tab.OaTabUserMapper;
import com.xnyzc.lhy.order.service.user.tab.IOaTabUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * Tab权限关联表 服务实现类
 * </p>
 *
 * @author bin
 * @since 2019-07-23
 */
@Service
public class OaTabUserServiceImpl extends ServiceImpl<OaTabUserMapper, OaTabUser> implements IOaTabUserService {

    @Autowired
    private OaTabUserMapper oaTabUserMapper;

    /**
     * 根据用户id与tabId获取用户关联信息
     * @param userId 用户id
     * @param tabId tabId
     * @return
     */
    @Override
    public OaTabUser getTab(long userId, int tabId) {
        return oaTabUserMapper.selectOne(
                Wrappers.<OaTabUser>lambdaQuery()
                        .eq(OaTabUser::getDeleted, "0")
                        .eq(OaTabUser::getUserId, userId)
                        .eq(OaTabUser::getTabId, tabId)
        );
    }
}
